package com.jinzheng.qhwocket.util.testDiaoyongSocket;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;
import java.util.List;

public class SquareDecoder extends ByteToMessageDecoder {
    @Override
    public void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out)
            throws Exception {
        ByteBuf buf = in.readRetainedSlice(in.readableBytes());
        byte[] bytes = ByteBufUtil.getBytes(buf);
        buf.release();
        out.add(bytes);
    }
}
